package cn.kgm.makeGodV2.ruleEngine;

import cn.kgm.makeGodV2.GamePlayer;
import cn.kgm.makeGodV2.ruleEngine.area.AreaInfo;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * @Version 1.8
 * @Author: Kappi
 * @Date: 2025-9-24 10:30
 * @Description: cn.kgm.makeGodV2.ruleEngine.RuleContext
 */
@Data
public class RuleContext {
    private Map<String, Object> params = new HashMap<>();
    private Map<String, Object> globalContext = new HashMap<>();
    // 规则配置JSON
    private String ruleConfig;
    //玩家信息
    private GamePlayer player;
    // 区域信息
    private AreaInfo area;

    public void setParam(String key, Object value) {
        params.put(key, value);
    }

    public Object getParam(String key) {
        return params.get(key);
    }

    public <T> T getParam(String key, Class<T> clazz) {
        return clazz.cast(params.get(key));
    }
}
